﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing;
using System.Linq;
using System.Text;

namespace C12_Ex03_Shaked_032675316_Itay_032511057
{
    public partial class NumeratorPictureButton : ResponsivePicture
    {
        private uint m_Numerator;

        public NumeratorPictureButton()
        {
            m_Numerator = 0;
            m_OnHoverEffect = new BorderControlPainter();
            InitializeComponent();
        }

        public NumeratorPictureButton(IContainer container)
        {
            container.Add(this);
            m_OnHoverEffect = new BorderControlPainter();
            InitializeComponent();
        }

        protected override void AdditionalDrawings(PaintEventArgs pe)
        {
            if (m_Numerator >= 0)
            {
                Rectangle pos = new Rectangle();
                pos.X = this.Width - 21;
                pos.Y = this.Height - 21;
                pos.Width = 20;
                pos.Height = 20;

                pe.Graphics.FillEllipse(Brushes.Red, pos);

                pos.X += 2;
                pos.Y += 2;
                pos.Width -= 4;
                pos.Height -= 4;

                pe.Graphics.FillEllipse(Brushes.Navy, pos);

                pos.X += 2;
                Font font = new Font("ariel", 9, FontStyle.Bold);
                pe.Graphics.DrawString(m_Numerator.ToString(), font, Brushes.White, pos.X, pos.Y);
            }   
        }

        protected override void DrawWhenClicked(PaintEventArgs pe)
        {
            SolidBrush brush = new SolidBrush(Color.FromArgb(100, Color.Blue));
            Region region = new Region(pe.ClipRectangle);
            pe.Graphics.FillRegion(brush, region);
        }

        public uint Numerator
        {
            get { return m_Numerator; }
            set
            {
                m_Numerator = value;
                Invalidate();
            }
        }
    }
}
